#encoding=utf8
'''
Created on Apr 8, 2015

@author: jingyang <jingyang@smalltreemedia.com>
'''
from django.shortcuts import render_to_response
from django.template.context import RequestContext

import settings


class CustomMiddleware(object):
    def process_request(self, request):
        if request.user.is_authenticated() and settings.MAINTAIN and not request.user.is_superuser:
            return render_to_response('base/maintenance.html', RequestContext(request))
